<?php
/**
 * Created by PhpStorm.
 * User: cape
 * Date: 2017/10/10
 * Time: 9:50
 */

$input = <<< 'EOF'
1;PHP;Likes dollar signs
2;Python;Likes whitespace
3;Ruby;Likes blocks
EOF;

function input_parser($input){
    foreach(explode("\n", $input) as $line){
        $fields = explode(';', $line);
        $id = array_shift($fields);
        yield $id=>$fields;
    }
}

foreach(input_parser($input) as $id=>$filed){
    echo "$id:\n";
    echo "     $filed[0]\n";
    echo "     $filed[1]\n";
}









